CC = cc

ROOTPATH=.
INCLUDE =  -I$(ROOTPATH)/inc -I$(ROOTPATH)/plugins/file
LIB=-lpthread

OBJ += $(patsubst %.c, %.o, $(wildcard *.c))
OBJ += $(patsubst %.c, %.o, $(wildcard $(ROOTPATH)/src/*.c))
OBJ += $(patsubst %.c, %.o, $(wildcard $(ROOTPATH)/plugins/file/elog_file.c))
OBJ += $(patsubst %.c, %.o, $(wildcard port/*.c))

CFLAGS = -O0 -g3 -Wall -fPIC -shared
target = libeasyLogger.so

all:$(OBJ)
	$(CC) -fPIC -shared out/*.o -o $(target)  -lm $(LIB)
	mv $(target) out
%.o:%.c
	$(CC) $(CFLAGS) -c $< -o $@ $(INCLUDE)
	mv $@ out
clean:
	rm -rf out/*
